import asyncio
import websockets
import numpy as np
import json



async def send_epoch_metrics(epoch, mae, mmre, mdae, pred):
    uri = "ws://localhost:8000/ws/training-results/"
    async with websockets.connect(uri) as websocket:
        metrics = {
            "type": "epoch_update",
            "epoch": 1,
            "mae": 2,
            "mmre": 3,
            "mdae": 4,
            "pred": 5
        }
        await websocket.send(json.dumps(metrics))
        response = await websocket.recv()
        data = json.loads(response)
        response = data.get("status")
        print(f"Received response: {response}")

if __name__ == "__main__":
    asyncio.run(send_epoch_metrics('1', '2', '3', '4', '5'))